dofile(os.getenv('LUAR_HOME') .. '/util/File.lua')

function execute()
	local template_folder = arg[2]
	local file = File{}
	if not file:exists( template_folder ) then
		print( 'There is not a template folder with name "' .. template_folder .. '" on current directory' )
		return false
	end
	if file:exists( os.getenv('LUAR_HOME') .. '/lib/templates/' .. template_folder ) then
		print( 'Already there is a template with name "' .. template_folder .. '" added to luar. Overwrite template? (y/n)' )
		local res = io.read()
		while( res ~= 'y' and res ~= 'n' ) do
			print( 'Already there is a template with name "' .. template_folder .. '" added to luar. Overwrite template? (y/n)' )
			res = io.read()
		end
		if res == 'n' then
			return false
		end
	end
	file:copy( template_folder, os.getenv('LUAR_HOME') .. '/lib/templates/' )
	return true;
end
